﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Token.Piker.BLL;
using Token.Util;

namespace Piker.AJAX
{
    /// <summary>
    /// Summary description for Activity
    /// </summary>
    public class Activity : IHttpHandler
    {
        public class SlideInfo
        {
            private string _descrip;

            public string Descrip
            {
                get { return _descrip; }
                set { _descrip = value; }
            }

            private int _count;

            public int Count
            {
                get { return _count; }
                set { _count = value; }
            }

        }
        static ActivityBLL activityMethod = new ActivityBLL();

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int slideID = Convert.ToInt32(context.Request.Params["slide_id"].ToString());
            SlideInfo slideInfo = new SlideInfo();
            DataSet slideDs = activityMethod.GetActivityList(1,"a.ID="+slideID+"","ID desc");
            slideInfo.Descrip = slideDs.Tables[0].Rows[0]["Descrip"].ToString();                                  //获取相册封面描述
            slideInfo.Count = Convert.ToInt32(slideDs.Tables[0].Rows[0]["PartCount"].ToString());              //获取参与画题人数
            context.Response.Write(JsonHelper.Serialize(slideInfo));
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}